<script setup>
import {computed, ref} from  'vue'
let chengji=ref(90)
function abc(){
    if(chengji.value<100)
        chengji.value++;
}
function sub(){
    if(chengji.value>0)
        chengji.value--;
}
const dengji=computed(()=>{
    let dj=''
    if(chengji.value>=90){
        dj='优秀'
    }
    else if(chengji.value<90&&chengji.value>=80)
        dj='良好'
    else if(chengji.value<80&&chengji.value>=70)
        dj='一般'
    else if(chengji.value>=60&&chengji.value<70)
        dj='及格'
    else
        dj='不及格'
    return dj
})
</script>
<template>
    <h1>计算属性</h1>
    <p>我的考试成绩为{{chengji}}</p>
    <p>我的考试成绩等级为{{dengji}}</p>
    <input v-model="chengji"  type="text"/>
    
    <button @click="abc">点击</button>
    <button @click="sub">点击</button>
</template>